package com.koala.learn.threadlearn.test;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;

/**
 * @Description TODO
 * @Date 2022/3/20 16:47
 * @Created by koala
 */
@Slf4j
public class Start {

    private static Integer count = new Integer(0);
    private static final int MAX = 10;

    @SneakyThrows
    public static void main(String[] args) {
        Thread[] threads = new Thread[MAX];
        for (int i = 0; i < MAX; i++) {
            threads[i] = new Thread(() -> {
                count += 1;
            });
        }
        for (int i = 0; i < MAX; i++) {
            threads[i].start();
            threads[i].join();

        }
        // 休息500s 等结果
//        Thread.sleep(1000);
        log.error("最终的结果 {}", count);
    }
}
